home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 52
/
Volume 52 - JOGO DISK .iso
/
Games
/
shopdrop.swf
/
scripts
/
__Packages
/
smashing
/
SoundHandler.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
2KB
|
95 lines
class smashing.SoundHandler
{
var cSound = 0;
var bMute = false;
function SoundHandler(loc)
{
this.location = loc;
this.aSnd = [];
var _loc3_ = undefined;
var _loc2_ = 0;
while(_loc2_ < 8)
{
_loc3_ = loc.createEmptyMovieClip("mcSnd" + _loc2_,_loc2_);
this.aSnd[_loc2_] = new Sound(_loc3_);
this.aSnd[_loc2_].bInterrupt = true;
_loc2_ = _loc2_ + 1;
}
}
function playSnd(sId, vol, oEnd)
{
if(this.bMute == true)
{
return undefined;
}
var _loc2_ = this.aSnd[this.cSound];
var _loc3_ = 1;
while(_loc2_.bInterrupt == false)
{
if(_loc3_ >= this.aSnd.length)
{
return undefined;
}
this.cSound = this.cSound + 1;
if(this.cSound >= this.aSnd.length)
{
this.cSound = 0;
}
_loc2_ = this.aSnd[this.cSound];
}
_loc2_.stop();
if(oEnd != undefined)
{
_loc2_.oEndRecv = oEnd;
_loc2_.bInterrupt = false;
_loc2_.onSoundComplete = this.onEnd;
}
if(vol != undefined)
{
_loc2_.setVolume(vol);
}
else
{
_loc2_.setVolume(100);
}
_loc2_.attachSound(sId);
_loc2_.start();
this.cSound = this.cSound + 1;
if(this.cSound >= this.aSnd.length)
{
this.cSound = 0;
}
return _loc2_;
}
function onEnd()
{
this.bInterrupt = true;
this.oEndRecv.onSoundEnd();
delete this.oEndRecv;
delete this.onSoundComplete;
}
function stopSounds()
{
stopAllSounds();
var _loc3_ = undefined;
var _loc2_ = 0;
while(_loc2_ < this.aSnd.length)
{
_loc3_ = this.aSnd[_loc2_];
_loc3_.bInterrupt = true;
delete _loc3_.oEndRecv;
delete _loc3_.onSoundComplete;
_loc2_ = _loc2_ + 1;
}
}
function mute()
{
this.stopSounds();
this.bMute = true;
}
function unMute()
{
this.bMute = false;
}
}